package cn.gene.timeyan.ums.webapi.ums.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSenderImpl;

/**
 * 配置邮箱
 */
@Configuration
public class MailConfiguration {
    @Autowired
    private MailPropertiesConfig config;
    @Bean
    public JavaMailSenderImpl javaMailSender(){
        JavaMailSenderImpl javaMailSender=new JavaMailSenderImpl();
        javaMailSender.setUsername(config.getUsername());
        javaMailSender.setPassword(config.getPassword());
        javaMailSender.setHost(config.getHost());
        javaMailSender.setPort(config.getPort());
        javaMailSender.setProtocol(config.getProtocal());
        return javaMailSender;
    }
}
